Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a reaction to alter the JSON-LD #24

Merged
merged 6 commits into from
Mar 8, 2018

Conversation

whikloj
Copy link
Member

@whikloj whikloj commented Feb 16, 2018

GitHub Issue: Islandora/documentation#768

What does this Pull Request do?

Adds a hook to alter the normalized jsonld array before we encode it as JSON.

What's new?

hook_jsonld_alter_normalized_array(EntityInterface $entity, array &$normalized, array $context)
  • Does this change require documentation to be updated? no
  • Does this change add any new dependencies? no
  • Does this change require any other modifications to be made to the repository
    (ie. Regeneration activity, etc.)? no
  • Could this change impact execution of existing code? no

How should this be tested?

There is a test in here and I will also test it with a reaction in Islandora soon.

Interested parties

@dannylamb @mjordan

@dannylamb
Copy link
Contributor

dannylamb commented Feb 16, 2018

Another option to consider if you want to re-use the existing ContextProviders without messing with dependencies would be to fire a hook/alter from this module, and implement the hook/alter in islandora. There you can create your ContextProviders and execute your reactions. It would decouple jsonld from the context module and would be more mainstream Drupal-y.

Better than a submodule just to hold a handful of classes. 🤷‍♂️

But I'm fine with it for now. It's always something we can address later. You're definitely on the right path. I've checked out the PRs and am 👍 I'll try pulling them in and giving them a whirl.

@whikloj
Copy link
Member Author

whikloj commented Feb 16, 2018

@dannylamb Some of these changes were because of the use of deprecated classes (EntityManager) and functions (drupal_basename) which is scheduled to be deprecated in 9. I figured I'd fix them up now so they don't get forgotten about.

Copy link
Contributor

@dannylamb dannylamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested in tandem with the Islandora PR

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants